define([ "dojo/_base/declare", "widgets/baseWidget/BaseWidget",
    "dojo/text!./templates/Template.html","dojo/json", "dojo/_base/array",
    "dojo/dom-class", "esri/symbols/PictureMarkerSymbol","dojo/on","esri/request",
    "esri/geometry/Polyline","esri/graphic","esri/symbols/SimpleLineSymbol","esri/geometry/Point",
    "esri/geometry/Extent","dojo/_base/Color","esri/SpatialReference","dojo/parser","esri/map",
    "esri/layers/ArcGISTiledMapServiceLayer","dojo/topic",
    "esri/symbols/SimpleFillSymbol",
    "esri/layers/FeatureLayer",
    "dojo/on",
    "esri/fx","esri/dijit/Scalebar",  "esri/layers/ArcGISDynamicMapServiceLayer","esri/renderers/SimpleRenderer"
    ,"dojo/dom-construct" 
    ],
    function(declare,BaseWidget, template,json, array, domClass,PictureMarkerSymbol,on,request,Polyline,
    		Graphic,SimpleLineSymbol,Point,Extent,Color,SpatialReference,Parser,Map,ArcGISTiledMapServiceLayer,
    		Topic,SimpleFillSymbol,FeatureLayer, on,FX,Scalebar,ArcGISDynamicMapServiceLayer,SimpleRenderer,domConstruct) {
        return declare([ BaseWidget], {
        	//模板页面
            templateString : template,
            //地图实例
            map:null,

            constructor : function() {
            	this.inherited(arguments);
                Global.arrNodeFeaLyer = [];  // 用来存储treeId 和 featureLayer

            },
            //组件初始化方法
            postCreate : function() {
            	this.inherited(arguments);
            	//创建地图
            	var initExt = new Extent(ioc.map.initExt);
            	domConstruct.place(this.domNode, dojo.body());
            	this.inherited(arguments);
            	map = new Map(this.mapcon);
            	map.setExtent(initExt);
            	map.setZoom(4);
                this.initLayers();
            },
            
            initLayers:function(){   // 初始化地图方法   在上面调用了
                var myTiledMapServiceLayer = new  ArcGISTiledMapServiceLayer(ioc.map.basemaps.cn);
                map.addLayer(myTiledMapServiceLayer);
             },
            startup:function(){
            },
            resizeHandle:function(){
            	this.map.reposition();
            	this.map.resize();
            },
            destroy:function(){
            	this.inherited(arguments);
            }

        });
    });
